﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InformationRetrieval.Tokenizer;

namespace InformationRetrieval.Indexer
{
    /// <summary>
    /// Interface for Construction of Inverted Index Classes
    /// </summary>
    interface IInvertedIndex
    {
        /// <summary>
        /// Method for Adding new Documents to the Index
        /// </summary>
        /// <param name="documentName">A distinct Document Name</param>
        /// <param name="documentTokens">A List of the Tokens in the Given Document</param>
        void AddDocument(string documentName, IEnumerable<PositionedToken> documentTokens);
        
        /// <summary>
        /// The Ultimate Search Method
        /// Give it a Search Query and it Finds your Documents, Guaranteed!
        /// </summary>
        /// <param name="searchQuery">A String of Query Tokens</param>
        /// <returns>A List of [Term, Postings] Tupels</returns>
        IEnumerable<KeyValuePair<string, InformationRetrieval.Indexer.InvertedIndex.Posting>> Find(string searchQuery);
        
        /// <summary>
        /// Method for Persisting the Index
        /// </summary>
        void Persist();

        /// <summary>
        /// Methods for Displaying Statistics
        /// </summary>
        int TermCount { get; }
        int DocumentCount { get; }
        int AvgPostingListLength { get; }
        IEnumerable<string> MostCommonTerms50 { get; }
    }
}
